package com.tuling.cloud.study.feign;

import com.tuling.cloud.study.User;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * 推荐使用
 */
@FeignClient(name = "microservice-consumer-order")
public interface OrderFeignClient {

  // 会根据name = "microservice-provider-user" 和 value = "/{id}", method = RequestMethod.GET
  // 这个几个属性来指定调用user服务哪个接口
  @RequestMapping(value = "/user/{id}", method = RequestMethod.GET)
  public User findByIdFromOrderService(@PathVariable("id") Long id); // 方法名称随便写，但是最好与提供方一样，参数和提供方列表参数的顺序一致
}
